Strict

Import mojo
Import agfx

Const MAX_CHANNELS:Int = 31

Class TSoundPlayer
	Field channel:Int
	
	Method Play:Void(s:Sound, pan:Float=0, rate:Float=1, volume:Float=1, loop:Int = 0)
	
		Self.channel += 1
		If (channel > MAX_CHANNELS) Then channel = 0

		StopChannel(channel)
		PlaySound(s, channel, loop)
		SetChannelPan(channel, pan)
		SetChannelRate(channel, rate)
		SetChannelVolume(channel, volume)
	End
	
	Method Stop:Void()
		StopChannel(channel)
	End Method
End


